/*
 * Shooter.java
 *
 * Created on 18. �erven 2007, 20:25
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package cz.possoft.serializable.chess.figurky;

import cz.possoft.messages.PropertiesManager;
import cz.possoft.messages.Text;
import cz.possoft.serializable.chess.game.ChessPole;

/**
 *
 * @author mara
 */
public class Shooter extends Figurka {
    
	public static final long serialVersionUID = 100458977;
	
    public Shooter() {        
    }
    
    /** Creates a new instance of Shooter */
    public Shooter(int x,int y,int color,ChessPole sachovnice) {
        setX(x);
        setY(y);
        setColor(color);
        setSachovnice(sachovnice);
        setMarked(false);
    }
    
    public String getFigurkaName() {
        return PropertiesManager.getInstance().getMessageForKey(Text.STRELEC);
    }
    
    public boolean muzeTahnout2(int xCil,int yCil) {
        if ((xCil<0)||(xCil>7)||(yCil<0)||(yCil>7)) return false;
          if (getSachovnice().getFigurka(xCil, yCil).getColor() != getColor()) {
          if (((getX()-xCil)==(getY()-yCil)) && (freeWay(xCil, yCil))) return true;
          if (((getY()-yCil)==(xCil-getX())) && (freeWay(xCil, yCil))) return true;
          }
        return false;
    }
    
}
